package com.jrx.anytxn.transaction.job.dailyAccount.step;

import com.jrx.anytxn.transaction.pojo.DailyAccount;
import org.apache.ibatis.session.SqlSessionFactory;
import org.mybatis.spring.batch.MyBatisPagingItemReader;

import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;

/**
 * 获取日终T24核心汇总记账金额
 *
 * @Author yhy
 * @Date 2023/4/29 15:42
 */
public class DailyAccountReader extends MyBatisPagingItemReader<DailyAccount> {

    /**
     * 按照支付渠道获取日终T24核心汇总记账金额
     * @param payChannel 支付渠道
     * @param sqlSessionFactory sql工厂对象
     */
    public DailyAccountReader(String payChannel, SqlSessionFactory sqlSessionFactory) {
        setSaveState(false);
        setSqlSessionFactory(sqlSessionFactory);
        setQueryId("com.jrx.anytxn.transaction.mapper.ext.ExtBtDailyAccountListMapper.sumBySettleChannel");

        Map<String, Object> map = new HashMap<>();
        // 日终T24核心汇总记账渠道列表
        map.put("settleChannels", Arrays.asList(payChannel.split(",")));
        setParameterValues(map);
    }
}
